#pragma once

#include <string>
#include <map>
#include <unordered_map>
#include "base/Define.h"
#include "protocol/routeinfo.pb.h"
#include <memory>
#include <shared_mutex>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include "store/RedisStore.h"

namespace zeroplus::mq
{
    class BrokerConfig
    {
    public:
        std::map<std::string, routeinfo::TopicData> topicConfigTable;
        std::string serverAddr;
        std::string publisherAddr;
        std::string clientAddr;
        std::string redisAddr;
        std::string redisHost;
        int redisPort;
        std::string brokerName;
        std::string clusterName;
        int brokerId;

    public:
        static BrokerConfig &getInstance()
        {
            static BrokerConfig instance; // 静态局部变量
            return instance;
        }

    private:
        // 私有构造函数
        BrokerConfig()
            : clusterName("ZeroPlusMQ"),
              brokerName(boost::uuids::to_string(boost::uuids::random_generator()())),
              brokerId(BrokerState::MASTER)
        {
        }

        // 私有拷贝构造函数和赋值操作符
        BrokerConfig(const BrokerConfig &) = delete;
        BrokerConfig &operator=(const BrokerConfig &) = delete;
    };
}
